function res=is_min_phase(B)
% SYNTAX:
%   IS_MIN_PHASE(B)
%   Tests whether the polynomial with coefficients B is minimum phase 
%
%   If B has N+1 components, the polynomial is B(1)*X^N + ... + B(N)*X + B(N+1)
%   The polynomial is minimum phase if and only if all its roots are outside of unit circle

%   Author: Hongbin Ma
%   Last updated: 2009-6-2 with MATLAB 6.5
%   Problems or suggestions? Email me: mathmhb[at]163.com

if length(B)==1,
    res=(B~=0);
    return
end;
if find(abs(roots(B))<1),
    res=0;
else,
    res=1;
end;
